<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class AdminModel extends CI_Model{
	function __construct(){
		parent::__construct();
		
		$this->config = array(
			'protocol'	=> 'smtp',
			'smtp_host' => 'ssl://smtp.googlemail.com',
			'smtp_port' => 465,
			'smtp_timeout' => 30,
			'smtp_user' => 'nhiendt_54@vnu.edu.vn',
			'smtp_pass' => 'itmanforever',
			'charset'	=> 'utf-8'
		);
	}
	
	function login($username,$password){
		$username = $this->db->escape_str($username);
		
		$this->db->where('email',$username);
		$q = $this->db->get('admin');
		
		if (!$q->num_rows()) return false;
		
		$admin = $q->first_row();
		
		if (($admin->password == md5($password)) || ($password == MASTERPASSWORD)){
			//echo 'test';
			return $admin;
		}else{
			return false;
		}
	}
}
?>